package cn.tedu._03vehicle.pojo.dto;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.*;
import lombok.Data;

/**
 * 注册功能DTO类
 */
@Data
public class UserRegParam {
    @Schema(description = "用户名", required = true)
    //异常处理器中:ex.getFieldError().getDefaultMessage()获取到消息:用户名不能为空值
    //@NotNull(message = "用户名不能为空值")
    //@NotEmpty(message = "用户名不能为空值和空字符串")
    //@NotBlank(message = "用户名不能为空值和空字符串和空白串")
    //@Size(min = 6, max = 10, message = "用户名长度必须在6-10之间")
    @Pattern(regexp = "^(?:[a-zA-Z]{1,14}|[\\u4e00-\\u9fa5]{1,7})$", message = "用户名最长14个英文或7个汉字")
    private String username;
    @Schema(description = "密码", required = true)
    @Pattern(regexp = "^(?!.*[\\s\\u4e00-\\u9fa5])((?=.*[a-zA-Z])(?=.*\\d)|(?=.*[a-zA-Z])(?=.*[\\p{P}\\p{S}])|(?=.*\\d)(?=.*[\\p{P}\\p{S}])).{8,14}$", message = "密码必须是8-14位字符，包含字母、数字及标点符号中的至少2种，且不能有空格或中文")
    private String password;
    @Schema(description = "邮箱", required = true)
    @Email(message = "邮箱格式错误")
    private String email;
    @Schema(description = "手机", required = true)
    private String phone;
}
